<%@page import="java.util.*"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.sql.*"%>
<%@ page import="org.json.simple.JSONObject"%>
<%@ page import="org.json.simple.JSONArray"%>
<%@ page import="java.net.URLEncoder"%>

<%
	
	String mcode=request.getParameter("mcode");
	String omcode=request.getParameter("omcode");
	String fmcode=request.getParameter("omcode");
	//String mcode="M1";
	//String omcode="M2";
	//String fmcode="M2";
			
	String url="jdbc:oracle:thin:@192.168.0.18:1521:orcl";
	String user="book";
	String password="book";
	
	String sql1=null;
	String sql2=null;
	
	String offinfo="";
	String userfollowinfo="";
	
	Connection conn=null;
	ResultSet rs1=null;
	ResultSet rs2=null;

	PreparedStatement stmt1=null;
	PreparedStatement stmt2=null;
	
	try{
		Class.forName("oracle.jdbc.driver.OracleDriver");
		//out.println("드라이버 로딩 성공");
		conn=DriverManager.getConnection(url, user, password);
		//out.println("접속 성공");

		sql1="select oreration from offmember where mcode=? and omcode=?";
		sql2="select * from follow where mcode=? and fmcode=?";
		
		stmt1=conn.prepareStatement(sql1);
		stmt2=conn.prepareStatement(sql2);
		
		stmt1.setString(1, mcode);
		stmt1.setString(2, omcode);
		rs1 = stmt1.executeQuery();
		
		stmt2.setString(1, mcode);
		stmt2.setString(2, fmcode);
		rs2 = stmt2.executeQuery();
		
		while(rs1.next()){
			offinfo=rs1.getString("oreration");
		}
		
		while(rs2.next()){
			String a="Y";
			userfollowinfo=a;
		}
		
	}catch(Exception e){
		out.println("접속 실패");
		e.printStackTrace();
	}finally{
		if(stmt1!=null) stmt1.close();
		if(stmt2!=null) stmt2.close();
		if(conn!=null) conn.close();
	}
	
%>
{"offinfo" : "<%= offinfo %>", "userfollowinfo" : "<%= userfollowinfo %>"}
